package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.victor.dao.SoncompanyDao;
import com.victor.entity.Administrator;
import com.victor.entity.Department;
import com.victor.entity.soncompany.Soncompany;
import com.victor.service.SoncompanyService;

@Service
public class SoncompanyServiceImpl implements SoncompanyService {

	@Autowired
	private SoncompanyDao dao;

	// 添加子公司
	@Override
	public boolean addSonCompany(Soncompany soncompany) {
		return dao.addSonCompany(soncompany) > 0 ? true : false;
	}

	// 添加部门信息
	@Override
	public boolean addSonCompanydepartments(Department departments) {
		return dao.addSonCompanydepartments(departments) > 0 ? true : false;
	}

	// 查询公司本部员工
	@Override
	public List<Administrator> getOwnEmployee(String soncompanyid) {
		return dao.getOwnEmployee(soncompanyid);
	}

	// 查询下属公司列表
	@Override
	public List<Soncompany> getSubordinateCompany(String soncompanyid) {
		return dao.getSubordinateCompany(soncompanyid);
	}

	// 修改公司详情
	@Override
	public boolean updSoncompany(Soncompany soncompany) {
		return dao.updSoncompany(soncompany) > 0 ? true : false;
	}

	// 删除所有本公司的原部门
	@Override
	public boolean delFormerDepartment(Integer companyid) {
		return dao.delFormerDepartment(companyid) > 0 ? true : false;
	}

}
